#include <QHBoxLayout>
#include <QApplication>
#include <QDesktopWidget>
#include "displayWidget.h"
#include "panel.h"
DisplayWidget::DisplayWidget(
        QString table,QString &f,DisplayPlot::CurveType type,  QWidget *parent) :QWidget(parent)
{
    int x = QApplication::desktop()->width();
    int y = QApplication::desktop()->height();
    this->resize(QSize( x -300, y - 200));

    this->setWindowFlags(Qt::FramelessWindowHint);
    this->setAutoFillBackground(true);

    QPalette palette;
    palette.setColor(QPalette::Background, QColor(30,144,255));
    this->setPalette(palette);

    dispayWidget = new DisplayPlot(table,f,type, this);
    //panel与plot关联起来
    panel = new Panel(dispayWidget, this) ;

    hLayout = new QHBoxLayout();
    hLayout->addWidget(panel);
    hLayout->addWidget(dispayWidget, 10);
    setLayout(hLayout);
}

DisplayWidget::~DisplayWidget()
{
    delete panel;
    delete hLayout;
    delete dispayWidget;
}
void DisplayWidget::closeEvent(QCloseEvent *)
{
   delete this;
}
